CROSS = /opt/dspg/v1.3.4-rc4/sysroots/x86_64-dspg-linux/usr/bin/armv5te-dspg-linux-uclibceabi/arm-dspg-linux-uclibceabi-

CC = $(CROSS)gcc

# -Os  
CFLAGS  = -Wall -g -std=gnu99 -Werror

LIBS += -lpthread -lrt
# LIBS += -L../xml_parser  -lxmlparser
# LIBS += -L../libxml2/.libs  -lxml2
# LIBS += -L../usocket -lusock
# LIBS += -L../cjson -lcjson 
LIBS += -L../mxml-2.10 -lmxml

INCLUDE += -I../include
INCLUDE += -I../mxml-2.10

BIN = xmlsock

MYLIB = libxmlsock.so 

SRCS = *.c
OBJECTS = $(subst .cc,.o,$(SRCS))

all: $(BIN) $(MYLIB)

$(MYLIB) : $(OBJECTS)
	$(CC) $(INCLUDE) $(CFLAGS) $(LDFLAGS)  -Os -s -shared -Wl,-soname,libxmlsock.so -o $@  $^ $(LIBS)

$(BIN) : $(OBJECTS)
	$(CC) $(INCLUDE) $(CFLAGS)  -s -o $@  $^  $(LIBS)

install:
	cp -f $(MYLIB) ../../rootfs/usr/lib
	cp -f $(BIN)   ../../rootfs/usr/bin

clean:
	rm -rf  *.o $(BIN)  $(MYLIB)
	

